<?php
namespace API\Controller;
use Think\Controller;
class NoticeController extends Controller {
    //推送列表接口
    public function getNotices(){

        $notices = M('notices');
        $data = $notices -> order("n_id")->select();

        echo json_encode($data);
         echo "<br>";

    }

    //推送详情接口
    public function getNoticeById(){

        $n_id = $_GET['n_id'];
        $getNoticesById = M('notices');
        $data = $getNoticesById ->where("n_id='$n_id'")-> select();

        echo json_encode($data);
         echo "<br>";

    }
    //删除所有推送接口
    public function noticeAllDelete(){


        $notices = M('notices');
        $data = $notices->where('1')->delete(); ;

        echo json_encode($data);
         echo "<br>";

    }
    //删除单条推送接口
    public function noticeDelete(){

        $n_id = $_GET['n_id'];
        $notices = M('notices');
        $data = $notices->where("n_id='$n_id'")->delete();

        echo json_encode($data);
         echo "<br>";

    }
}
?>
